From: Jan Beulich Date: Tue, 9 Jun 2015 13:56:03 +0000 (+0200) Subject: make do_sched_op_compat() x86-specific X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3125 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6041a60e162b6e8ad9687aa8932dabc332df1897;p=xen.git make do_sched_op_compat() x86-specific Being a pre-3.1 compatibility hypercall handler only, it's not needed on ARM or any future architectures Xen may get ported to. Also the function shouldn't really be used internally - its use should be limited to its purpose (and hence there's also no need for a prototype). Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Acked-by: Ian Campbell --- diff --git a/xen/arch/x86/compat.c b/xen/arch/x86/compat.c index 2d05867eba..2d4be2e899 100644 --- a/xen/arch/x86/compat.c +++ b/xen/arch/x86/compat.c @@ -5,9 +5,10 @@ * hypercall after doing necessary argument munging. */ -#include #include #include +#include +#include #ifndef COMPAT typedef long ret_t; @@ -26,6 +27,28 @@ ret_t do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop) #ifndef COMPAT +/* Legacy hypercall (as of 0x00030101). */ +long do_sched_op_compat(int cmd, unsigned long arg) +{ + switch ( cmd ) + { + case SCHEDOP_yield: + case SCHEDOP_block: + return do_sched_op(cmd, guest_handle_from_ptr(NULL, void)); + + case SCHEDOP_shutdown: + TRACE_3D(TRC_SCHED_SHUTDOWN, + current->domain->domain_id, current->vcpu_id, arg); + domain_shutdown(current->domain, (u8)arg); + break; + + default: + return -ENOSYS; + } + + return 0; +} + /* Legacy hypercall (as of 0x00030202). */ long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop) { diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index f354cb7a76..1c3e75a5f5 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2705,7 +2705,7 @@ void hvm_hlt(unsigned long rflags) if ( unlikely(!(rflags & X86_EFLAGS_IF)) ) return hvm_vcpu_down(curr); - do_sched_op_compat(SCHEDOP_block, 0); + do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void)); HVMTRACE_1D(HLT, /* pending = */ vcpu_runnable(curr)); } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 6734fb6fd0..a02f983f62 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -1988,7 +1988,7 @@ static void svm_vmexit_do_pause(struct cpu_user_regs *regs) * Do something useful, like reschedule the guest */ perfc_incr(pauseloop_exits); - do_sched_op_compat(SCHEDOP_yield, 0); + do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void)); } static void diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c index 1e5a570261..2f22783625 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -561,7 +562,7 @@ int viridian_hypercall(struct cpu_user_regs *regs) { case HvNotifyLongSpinWait: perfc_incr(mshv_call_long_wait); - do_sched_op_compat(SCHEDOP_yield, 0); + do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void)); status = HV_STATUS_SUCCESS; break; default: diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index af257db4da..0837627e81 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -3198,7 +3198,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) case EXIT_REASON_PAUSE_INSTRUCTION: perfc_incr(pauseloop_exits); - do_sched_op_compat(SCHEDOP_yield, 0); + do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void)); break; case EXIT_REASON_XSETBV: diff --git a/xen/common/schedule.c b/xen/common/schedule.c index f5a2e55a59..6b02f9815a 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -882,39 +882,6 @@ void watchdog_domain_destroy(struct domain *d) kill_timer(&d->watchdog_timer[i]); } -long do_sched_op_compat(int cmd, unsigned long arg) -{ - long ret = 0; - - switch ( cmd ) - { - case SCHEDOP_yield: - { - ret = vcpu_yield(); - break; - } - - case SCHEDOP_block: - { - vcpu_block_enable_events(); - break; - } - - case SCHEDOP_shutdown: - { - TRACE_3D(TRC_SCHED_SHUTDOWN, - current->domain->domain_id, current->vcpu_id, arg); - domain_shutdown(current->domain, (u8)arg); - break; - } - - default: - ret = -ENOSYS; - } - - return ret; -} - typedef long ret_t; #endif /* !COMPAT */ diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index eda8a36c46..79fe114287 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -21,11 +21,6 @@ extern long do_ni_hypercall( void); -extern long -do_sched_op_compat( - int cmd, - unsigned long arg); - extern long do_sched_op( int cmd,